﻿using System;
using System.Collections.Generic;
using DC2010.Conditions;
using DC2010.Objects.Base;
using DC2010.Objects.Common;

namespace DC2010.Objects.Data
{
    [Serializable]
    public class ConditionData : BaseData
    {

        /// <summary>
        /// Effect executed in case that condition is fullfilled.
        /// </summary>
        public List<KeyValue> TrueEffect { get; set; }

        /// <summary>
        /// Effect executed in case that condition is NOT fullfilled.
        /// </summary>
        public List<KeyValue> FalseEffect { get; set; }
		
	    public ConditionGfx Gfx
        {
            get
            {
                if (!string.IsNullOrEmpty(GfxId))
                {
                    return Root.I.ConditionSystem.GetGfx(GfxId);
                }

                return null;
            }
        }		


        private ConditionLogic _l;
        public ConditionLogic L
        {
            get
            {
                if (_l == null)
                    _l = Root.I.ConditionSystem.InstantiateCondition(this);

                return _l;
            }
        }


        public ConditionData()
        {
            TrueEffect = new List<KeyValue>();
            FalseEffect = new List<KeyValue>();
        }
    }
}
